package Recommend;

import java.io.IOException;
import java.util.Set;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import BUCF.recommendSpots;

public class recommendSpotServlet extends HttpServlet {

	private static final long serialVersionUID = 5315040102022473684L;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setHeader("content-type", "text/html;charset=UTF-8");
		response.setCharacterEncoding("UTF-8");
		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("charset=utf-8");
		// PrintWriter out = response.getWriter();
		// String user=request.getParameter("user").trim();
		String userId = "17608579";
		Set<String> spots = new recommendSpots(userId, 10).getSpots();
		request.setAttribute("spots", spots);
		request.getRequestDispatcher("show.jsp").forward(request, response);
	}
}
